<script setup lang="ts">
const emits = defineEmits(['header', 'bread'])
emits('header', false)
emits('bread', false)
import { Iphone, Lock } from '@element-plus/icons-vue'
import useLogin from '@/hooks/useLogin'
import { reactive, ref } from 'vue';
import { useRouter } from 'vue-router'
const router = useRouter()
// const { login, form } = useLogin()
const loginForm = ref('')
const vdata = reactive({
  from: {}
})
const rules = reactive({
  member_phone: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
  password: [{ required: true, message: '请输入密码', trigger: 'blur' }]
})
const login = () => {
  router.push({ path: '/' })
}
</script>
<template>
  <div class="login-container">
    <div class="login-main">
      <div class="login_box">
        <div class="login_form">
          <div>登录</div>
          <el-form ref="loginForm" v-model="vdata.from" :rules="rules" label-position="left" inline
            style="margin-top: 80px;">
            <el-form-item label="手机号" porp="member_phone" style="display: flex;flex-direction: column;"
              v-model="vdata.from.member_phone">
              <el-input type="text" oninput="if(value>11){value=value.substring(0, 11)}" placeholder="请输入手机号"
                :prefix-icon="Iphone" />
            </el-form-item>
            <el-form-item label="密码" porp="password" style="display: flex;flex-direction: column;"
              v-model="vdata.from.password">
              <el-input type="password" maxlength="16" placeholder="请输入密码" :prefix-icon="Lock" />
            </el-form-item>
            <el-button type="primary" link>
              <el-icon>
                <Warning />
              </el-icon>未注册？点击此处
            </el-button>
            <el-button style="float: right;margin-right: 35px;margin-top: 65px;" type="primary"
              @click="login">确认</el-button>
          </el-form>
        </div>
        <div class="log_img"></div>
      </div>
      <div class="login-footer">明宇商城</div>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.login-container {
  display: flex;
  height: 100%;
  position: relative;
  min-height: 720px;

  .login-main {
    height: 450px;
    width: 400px;
    // display: flex;
    // align-items: center;
    // justify-content: center;
    // margin: 0 auto;
    // margin-top: 60px;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    margin: auto;
  }

  .login_box {
    height: 420px;
    width: 400px;
    background-color: #fff;
    // display: flex;
    // align-items: center;
    // justify-content: center;
    position: relative;

    .login_form {
      padding-left: 5px;
    }

    .log_img {
      position: absolute;
      height: 160px;
      width: 160px;
      top: -80px;
      left: 50%;
      transform: translate(-50%, 0);
      background-image: url(/src/assets/Imgs/login.png);
      background-size: 100%;
      z-index: 1;
    }
  }

  .login-footer {
    text-align: center;
    font-size: 32px;
    font-weight: bold;
    height: 50px;
    line-height: 50px;
    letter-spacing: 20px;
  }

  img {
    height: 400px;
    width: 600px;
  }

  .login_right {
    width: 330px;
    margin-left: 60px;
    position: relative;

    .title {
      text-align: left;
      font-size: 32px;
      color: #2a359c;
      line-height: 50px;
    }
  }
}
</style>
